from django.db import models

from django.contrib.auth.models import User
# Create your models here.


class Roles(models.Model):
    """
    角色信息
    """
    title = models.CharField(max_length=32,unique=True)
    label = models.CharField(max_length=64,null=True,blank=True)

class Users(models.Model):
    """
    用户信息
    """
    username = models.CharField(max_length=32,unique=True)
    nick_name = models.CharField(max_length=64,null=True,blank=True)
    password = models.CharField(max_length=128)
    state = models.BooleanField(default=False)
    is_super = models.BooleanField(default=False)
    last_login = models.DateTimeField(auto_now=True)
    create_date = models.DateTimeField(auto_now_add=True)
    #用户 与 角色 多对多关系
    roles = models.ManyToManyField(to='Roles')

